package com.gxxy.spring.kp02_modules.cls02_container.s5_scope;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class ScopeBeanTest {
	
	@Autowired
	ApplicationContext appCtx;
	
	@Test
	public void testScopeBean() throws Exception {
		IScopeBean bean1 = appCtx.getBean("testScopeBean", IScopeBean.class);
		IScopeBean bean2 = appCtx.getBean("testScopeBean", IScopeBean.class);
		bean2.destroy();
		System.out.println(bean1 == bean2);
	}
	
}
